﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace DK.Sort
{
    public class SelectionSort : ISort
    {
        public void Sort(int[] array)
        {
            for (int i = 0; i < array.Length - 1; i++)
            {
                int minindex = i;
                for (int j = i + 1; j < array.Length; j++)
                {
                    if (array[j] < array[minindex]) 
                    {
                        minindex = j;
                    }
                }

                ISort.Transfrom(array, i, minindex);
            }
        }
    }
}
